/* 
* @Author: Turbidsoul Chen
* @Date:   2016-11-28 10:50:16
* @Last Modified by:   Turbidsoul
* @Last Modified time: 2017-01-26 15:58:04
*/

import React from 'react';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import Root from './app/Root';
import { RouterStore, syncHistoryWithStore } from 'mobx-react-router';
import { hashHistory } from 'react-router';
import * as appstores from './app/stores';

let routing = new RouterStore();
let history = syncHistoryWithStore(hashHistory, routing);

console.log(appstores);
let stores = {
  routing,
  ...appstores
};
console.log(stores);
function renderApp(RootComponent) {
  return render(
    <AppContainer>
      <RootComponent stores={stores} history={history}/>
    </AppContainer>,
    document.getElementById('app')
  );
}
renderApp(Root);
if (module.hot) {

  module.hot.accept('./app/Root', () => {
    const NextApp = require('./app/Root').default;

    renderApp(NextApp);
  });
}

